﻿using NLog;

namespace Runoi.StockQuantBrain
{
    /// <summary>
    /// 日志帮助类
    /// </summary>
    public static class LogHelper
    {
        private static readonly Logger Log = LogManager.GetCurrentClassLogger(); // 获取 NLog 日志记录器

        /// <summary>
        /// 记录交易日志
        /// </summary>
        /// <param name="stockCode">股票代码</param>
        /// <param name="price">交易价格</param>
        /// <param name="quantity">交易数量</param>
        /// <param name="isBuy">是否为买入交易</param>
        public static void LogTrade(string stockCode, decimal price, int quantity, bool isBuy)
        {
            Log.Trace($"[Trade] Stock={stockCode}, Price={price}, Quantity={quantity}, Type={(isBuy ? "Buy" : "Sell")}");
        }

        /// <summary>
        /// 记录错误日志
        /// </summary>
        /// <param name="message">错误信息</param>
        public static void LogError(string message)
        {
            Log.Error(message);
        }
    }
}
